<!DOCTYPE html>



<html>







<head>



	<meta charset="utf-8">



	<title></title>



	<meta name="renderer" content="webkit">



	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">



	<meta name="viewport"
		content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">



	<link rel="stylesheet" href="/public/static/layuiadmin/layui/css/layui.css" media="all">



	<link rel="stylesheet" href="/public/static/layuiadmin/style/admin.css" media="all">

	<style>
		.layui-form-label {
			width: 160px !important;
		}

		.layui-input-block {
			margin-left: 190px;
		}
	</style>



</head>







<body>



	<div class="layui-fluid">



		<div class="layui-card">



			<div class="layui-card-body" style="padding: 15px;">



				<form class="layui-form" method="post" lay-filter="component-form-group" id="moduleForm">



					<input type="hidden" name="module_id" value="{$params.module_id}" />



					<div class="layui-form-item">



						<label class="layui-form-label">名称</label>



						<div class="layui-input-block">



							<input type="text" name="title" lay-verify="required" placeholder="请输入名称" autocomplete="off"
								class="layui-input">



						</div>



					</div>



					<!-- <div class="layui-form-item">



							<label class="layui-form-label">图片</label>



							<div class="layui-input-block">



								<div class="layui-upload">



								  <div class="layui-upload-list">



										<input type="hidden" name="images" />



								    <img class="layui-upload-img" id="upload_images" width="100" height="100" src="/public/static/Admin/img/upload.png">



								    <p id="demoText" style="color:#f00;">图片上传格式【jpg,png,jpeg】，上传大小【{$img_size}px】</p>



								  </div>



								</div>



							</div>



						</div> -->



					<div class="layui-form-item">



						<label class="layui-form-label">文件</label>



						<div class="layui-input-block">



							<div class="layui-upload">



								<div class="layui-upload-list">



									<input type="hidden" name="file_path" />



									<img class="layui-upload-img" id="upload_file_path" width="100" height="100"
										src="/public/static/Admin/img/upload.png">



									<p id="minDemoText" style="color:#f00;">文件上传大小【10M 以内】</p>



								</div>



							</div>



						</div>



					</div>



					<div class="layui-form-item">



						<label class="layui-form-label">排序号</label>



						<div class="layui-input-block">



							<input type="text" name="orders" value="99999" lay-verify="required" placeholder="请输入排序号"
								autocomplete="off" class="layui-input">



						</div>



					</div>



					<div class="layui-form-item">



						<label class="layui-form-label">内容</label>



						<div class="layui-input-block">



							<script id="container" name="content" type="text/plain"></script>



						</div>



					</div>



					<div class="layui-form-item layui-layout-admin">



						<div class="layui-input-block">



							<div class="layui-footer" style="left: 0;">



								<button class="layui-btn" lay-submit="" lay-filter="component-form-demo1">保存</button>



							</div>



						</div>



					</div>



				</form>



			</div>



		</div>



	</div>



	<script src="/public/static/layuiadmin/layui/layui.js"></script>



	<!-- 编辑器源码文件 -->



	<script type="text/javascript" src="/public/static/layuiadmin/ueditor/ueditor.config.js"></script>



	<!-- 配置文件 -->



	<script type="text/javascript" src="/public/static/layuiadmin/ueditor/ueditor.all.js"></script>



	<!-- 实例化编辑器 -->



	<script type="text/javascript">



		var ue = UE.getEditor('container');



	</script>



	<script>



		layui.config({



			base: '/public/static/layuiadmin/' // 静态资源所在路径



		}).extend({



			index: 'lib/index', // 主入口模块



			api: 'api'



		}).use(['index', 'form', 'laydate', 'api', 'upload'], function () {



			var $ = layui.$,



				admin = layui.admin,



				element = layui.element,



				layer = layui.layer,



				laydate = layui.laydate,



				api = layui.api,



				upload = layui.upload,



				form = layui.form;







			form.render(null, 'component-form-group');







			// 图片上传



			var uploadInst = upload.render({



				elem: '#upload_images',



				url: '{:url("Uploads/uploads")}', // 改成您自己的上传接口



				before: function (obj) {



					// 预读本地文件示例，不支持ie8



					obj.preview(function (index, file, result) { });



				},



				done: function (res) {



					// 如果上传失败



					if (res.code > 0) {



						return layer.msg('上传失败');



					} else {



						$('#upload_images').attr('src', res.data); // 图片链接（base64）



						$("input[name='images']").val(res.data);



					}



					// 上传成功



				},



				error: function () { }



			});







			// 图片上传



			var uploadInst = upload.render({



				elem: '#upload_file_path',



				accept: 'file',



				url: '{:url("Uploads/uploads")}', // 改成您自己的上传接口



				before: function (obj) {



					// 预读本地文件示例，不支持ie8



					obj.preview(function (index, file, result) { });



				},



				done: function (res) {



					// 如果上传失败



					if (res.code > 0) {



						return layer.msg('上传失败');



					} else {



						$('#upload_file_path').attr('src', '/public/static/Admin/img/files.png'); // 图片链接（base64）



						$("input[name='file_path']").val(res.data);



					}



					// 上传成功



				},



				error: function () { }



			});







			/* 监听提交 */



			form.on('submit(component-form-demo1)', function (data) {



				var dats = data.field;



				var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引



				dats.content = UE.getEditor('container').getContent();



				layer.msg('加载中', {



					icon: 16,



					shade: 0.01



				});



				api.ajax('{:url("save")}', 'post', 'json', dats, function (res) {



					layer.closeAll('loading');



					layer.msg(res.msg);



					$("#moduleForm")[0].reset();



				});



				return false;



			});



		});



	</script>



</body>







</html>